<?php

namespace app\api\controller\supplier;

use app\api\base\RestfulBase;
use JPush\Client as JPush;

Class Test extends RestfulBase
{

    protected function _initialize()
    {

    }

    public function index(){
        //极光推送测试
        $app_key ='863f1505c18b64bba62c1b86';
        $master_secret ='90830932b0c55ad88bdb6bfd';
        $client = new JPush($app_key, $master_secret);
        $pusher = $client->push();
        $pusher->setPlatform('all');
        $pusher->addAllAudience();
        $pusher->setNotificationAlert('Hello, JPush');
        try {
            $pusher->send();
        } catch (\JPush\Exceptions\JPushException $e) {
            // try something else here
            print $e;
        }
    }

}

